﻿using System;

namespace JasonTools
{
    public static class RandomExtension
    {
        public static int NextOtherThan(this Random random, int minValue, int maxValue, int otherThan)
        {
            int result = random.Next(minValue, maxValue);
            while (result == otherThan)
            {
                result = random.Next(minValue, maxValue);
            }
            return result;
        }

        public static int NextOtherThan(this Random random, int maxValue, int otherThan)
        {
            return NextOtherThan(random, 0, maxValue, otherThan);
        }
    }
}
